Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add SysV semaphore constants #4286

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bertptrs
Copy link

@bertptrs bertptrs commented Feb 25, 2025

Description

This patch adds missing constants required to use the SysV semaphore system, fixes #4264. Arguably, most of these constants should be c_short rather than c_int, as that is how they are used, but they already exist for other UNIXes as c_int so I opted to be consistent with those.

Sources

Definitions: https://github.com/torvalds/linux/blob/cc8a0934d099b8153fc880a3588eec4791a7bccb/include/uapi/linux/sem.h#L7-L22

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

@rustbot
Copy link
Collaborator

rustbot commented Feb 25, 2025

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@@ -2979,6 +2979,19 @@ pub const MSG_NOERROR: c_int = 0o10000;
pub const MSG_EXCEPT: c_int = 0o20000;
pub const MSG_ZEROCOPY: c_int = 0x4000000;

pub const SEM_UNDO: c_int = 4096;
Copy link
Contributor

@tgross35 tgross35 Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the literal to 0x1000 to match the Linux header? Please squash after, otherwise lgtm

@bertptrs bertptrs force-pushed the sysv-semaphore-constants branch from 3dacbcd to cb8c0ba Compare March 1, 2025 09:20
@bertptrs bertptrs requested a review from tgross35 March 1, 2025 09:22
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@tgross35 tgross35 force-pushed the sysv-semaphore-constants branch from cb8c0ba to f84f618 Compare March 1, 2025 09:34
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add missing constants for System V semaphores
3 participants